
//FOR MOSCOW STUDY


//start by loading MoscowClean.csv

//encode factor variables
encode dep2, gen(dep_enc)
encode region1, gen(reg_enc)


// make years in labor force variable

gen work_yr = class_yr
replace work_yr = . if class_yr == 1
replace work_yr = 4 if class_yr == 5 
replace work_yr = work_yr - 1


// TABLE 1 - DESCRIPTIVE STATISTICS

//Moscow full sample
eststo clear 
estpost tabstat psm job_sect pub_avg priv_avg male rel_pubsect religion risk_averse1 gpa family_inc, statistics(mean sd min max count) columns(statistics)
esttab, cells("mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0)) count(fmt(0))") nostar unstack nonote nomtitle nonumber replace label fragment

//Moscow panel only
eststo clear 
estpost tabstat psm2019 psm pub job_sect pub_avg priv_avg male rel_pubsect religion risk_averse1 gpa family_inc if panel == 1, statistics(mean sd min max count) columns(statistics)
esttab, cells("mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0)) count(fmt(0))") nostar unstack nonote nomtitle nonumber replace label fragment




//TABLE 2  
//career preferences and post-grad employment regressed on psm


global controls_moscow male risk_averse1 rel_pubsect religion gpa family_inc i.class_yr ib5.dep_enc ib2.reg_enc 


eststo clear
foreach var in job_sect pub_avg priv_avg pub {  
   reg `var' psm $controls_moscow, robust
   estimates store `var'_moscow_full
   }
   
   
eststo clear
foreach var in job_sect pub_avg priv_avg pub {  
   reg `var' psm $controls_moscow if panel == 1, robust
   estimates store `var'_moscow_panel
   }
   
esttab job_sect_moscow_full pub_avg_moscow_full priv_avg_moscow_full job_sect_moscow_panel pub_avg_moscow_panel priv_avg_moscow_panel pub_moscow_panel ,  ///
se(3) b(3) r2 nogaps star(+ 0.10 * 0.05 ** 0.01 *** 0.001) compress unstack replace label ///
nonumbers starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001)  mtitles( "Public Sector Preference" "Public Sector Index" "Private Sector Index" "Public Sector Preference" "Public Sector Index" "Private Sector Index" "Public Sector Employment")  /// 
drop (*.class_yr) 


//TABLE 4

// change in PSM for those employed in public sector
ttest psm = psm2019 if pub19 == 1
// change in PSM for those employed in private sector
ttest psm = psm2019 if pub19 == 0

//difference in PSM across sectors in initial study
ttest psm if psm2019 != ., by(pub19) //need psm2019 != . to keep number of observations the same for psm (in 2016) vs psm2019
//difference in PSM across sectors three years after study
ttest psm2019, by(pub19)

//difference in change in PSM across sectors
ttest psm_change, by(pub19)



//TABLE 5
//psm in 2019 and change in psm regressed on employment in 2019

global controls_moscow_no_class_yr male risk_averse1 rel_pubsect religion gpa family_inc ib5.dep_enc ib2.reg_enc 


eststo clear
reg psm2019 pub19 $controls_moscow, robust
estimates store psm2019_moscow

eststo clear
reg psm_change pub19 $controls_moscow, robust
estimates store psm_change_moscow

eststo clear
reg psm_change work_yr $controls_moscow_no_class_yr if pub19 != ., robust
estimates store psm_change_work_yr_moscow

eststo clear
reg psm_change i.pub19##c.work_yr $controls_moscow_no_class_yr, robust
estimates store psm_change_interact_moscow



esttab psm2019_moscow psm_change_moscow psm_change_work_yr_moscow psm_change_interact_moscow, ///
se(3) b(3) r2 nogaps star(+ 0.10 * 0.05 ** 0.01 *** 0.001) compress unstack replace label ///
nonumbers starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001)  mtitles( "Post-Grad PSM" "PSM Change" "PSM Change" "PSM Change" "Public Sector Index")  /// 
drop (*.class_yr) 



